home *** CD-ROM | disk | FTP | other *** search
/ Sun Solutions 2000 #2 / Sun Solutions CD (Volume 2 2000)(Special Focus - Java Technologies)(Disc 1).ISO / products / Software / Wind_River / _install / install.kit < prev    next >
Text File  |  2000-02-15  |  64KB  |  2,145 lines

  1. #!/bin/csh -f
  2. ###############################################################################
  3. #
  4. #                SNiFF+ INSTALLATION
  5. #
  6. ###############################################################################
  7. #
  8. #                  SNiFF+ 3.X installation procedure
  9. #            Copyright (c) 1999 TakeFive Software GmbH
  10. #                         All rights reserved.
  11. #
  12. #    This software has been provided pursuant to a License Agreement
  13. #    containing restrictions on its use.  This software contains
  14. #    valuable trade secrets and proprietary information of 
  15. #    TakeFive Software GmbH and is protected by law.  It may 
  16. #    not be copied or distributed in any form or medium, disclosed 
  17. #    to third parties, reverse engineered or used in any manner not 
  18. #    provided for in said License Agreement except with the prior 
  19. #    written authorization from TakeFive Software GmbH.
  20. #
  21. #   The size of the package is calculated with KB = gzip size/975
  22. #   This is 5% more space for save installing
  23. ###############################################################################
  24. #set verbose     = 1
  25. set SNiFFversion = '3.2'
  26. set nonomatch    = 1
  27. set no_perm      = 0
  28. set kitroot     = `pwd`
  29. set same_version = 0
  30.  
  31. #################################### versions #################################
  32.   set gccversion   = '2.7.2.2'
  33.   set gdbversion   = '4.16'
  34.   set rcsversion   = '5.7'
  35.   set mk_version   = '3.74'
  36.   set libgversion  = '2.7.2'
  37.   set jdkversion   = '1.1.1'
  38. ################################ default values ###############################
  39.   set gnudir = '/usr/local'
  40.   set nl_zcat   = ("gzcat." "gzcat" "GZCAT" "GZCAT." "GZCAT.;1")
  41.   set nl_tar     = ("tar." "tar" "TAR" "TAR." "TAR.;1")
  42.  
  43. ################################ package sizes ################################
  44.   set size_SNiFF = 0
  45.   set size_common_SNiFF = 0
  46.   set size_doc = 0
  47.   set size_com_exa = 0
  48.   set size_bin_exa = 0
  49.   set size_gcc = 0
  50.   set size_libg = 0
  51.   set size_gdb = 0
  52.   set size_rcs = 0
  53.   set size_mk = 0
  54.   set size_bin_vim = 0
  55.   set size_visaj = 0
  56.  
  57. ################################ filenames ###################################
  58. set nl_install          = ("install.kit" "INSTALL.KIT" "INSTALL.KIT;1")
  59.  
  60. set nl_sundir           = ("sunos" "SUNOS" "SUNOS")
  61. set sundir          = "sparc-sun-sunos4.1"
  62. set nl_solarisdir        = ("solaris" "SOLARIS" "SOLARIS")
  63. set solarisdir            = "sparc-sun-solaris2.3"
  64. set nl_hpriscdir      = ("hpux" "HPUX" "HPUX")
  65. set hpriscdir             = "pa_risc-hp-hpux10"
  66. set nl_osfdir            = ("osf" "OSF" "OSF")
  67. set osfdir                = "alpha-dec-osf3.0"
  68. set nl_ibmrsdir            = ("aix" "AIX" "AIX")
  69. set ibmrsdir              = "rs6000-ibm-aix4.2"
  70. set nl_irixdir            = ("irix" "IRIX" "IRIX")
  71. set irixdir               = "mips-sgi-irix5.3"
  72. set nl_scodir            = ("sco" "SCO" "SCO")
  73. set scodir                = "i386-unknown-sco3.2v4.2"
  74. set nl_linux_rh_dir      = ("linux-glibc" "LINUX-GLIBC" "LINUX-GLIBC")
  75. set linux_rh_dir      = "i586-linux-glibc"
  76. set nl_usldir          = ("unixware" "UNIXWARE" "UNIXWARE")
  77. set usldir          = "i386-unknown-unixware7"
  78. set nl_ncrdir          = ("ncr" "NCR" "NCR")
  79. set ncrdir          = "i386-ncr-sysv4.0"
  80. set nl_sinixdir            = ("sinix" "SINIX" "SINIX")
  81. set sinixdir              = "mips-sni-sinix5.42"
  82.  
  83. set nl_sniffbin          = ("sniffbin.tgz" "SNIFFBIN.TGZ" "SNIFFBIN.TGZ;1")
  84. set nl_sniffcommon      = ("sniff.tgz" "SNIFF.TGZ" "SNIFF.TGZ;1")
  85.  
  86. set nl_gccbin          = ("gccbin.tgz" "GCCBIN.TGZ" "GCCBIN.TGZ;1")
  87. set nl_gdbbin          = ("gdbbin.tgz" "GDBBIN.TGZ" "GDBBIN.TGZ;1")
  88. set nl_rcsbin             = ("rcsbin.tgz" "RCSBIN.TGZ" "RCSBIN.TGZ;1" )
  89. set nl_mk_bin             = ("mk_bin.tgz" "MK_BIN.TGZ" "MK_BIN.TGZ;1" )
  90. set nl_libgarchive      = ("libg.tgz" "LIBG.TGZ" "LIBG.TGZ;1")
  91. set nl_vimbin          = ("vimbin.tgz" "VIMBIN.TGZ" "VIMBIN.TGZ;1")
  92.  
  93. set nl_copy          = ("copy.txt" "COPY.TXT" "COPY.TXT;1")
  94. set nl_copylib          = ("copylib.txt" "COPYLIB.TXT" "COPYLIB.TXT;1")
  95.  
  96.  
  97. set nl_examples            = ("example.tgz" "EXAMPLE.TGZ" "EXAMPLE.TGZ;1")
  98.  
  99. set nl_docfiles           = ("doc.tgz" "DOC.TGZ" "DOC.TGZ;1")
  100.  
  101. set nl_gnusrcdir      = ("gnusrc" "GNUSRC" "GNUSRC")
  102. set nl_gcc          = ("gccsrc.tgz" "GCCSRC.TGZ" "GCCSRC.TGZ;1")
  103. set nl_gdb          = ("gdbsrc.tgz" "GDBSRC.TGZ" "GDBSRC.TGZ;1")
  104. set nl_libg          = ("libgsrc.tgz" "LIBGSRC.TGZ" "LIBGSRC.TGZ;1")
  105. set nl_rcs          = ("rcssrc.tgz" "RCSSRC.TGZ" "RCSSRC.TGZ;1")
  106. set nl_mk          = ("mk_src.tgz" "MK_SRC.TGZ" "MK_SRC.TGZ;1")
  107.  
  108. set nl_jdkdir             = ("jdk" "JDK" "JDK")
  109. set nl_jdk                = ("jdk111.tgz" "JDK111.tgz" "JDK111.tgz;1")
  110.  
  111. set nl_visaj              = ("visaj.tgz" "VISAJ.TGZ" "VISAJ.TGZ;1")
  112. set visajdir              = "Visaj"
  113.  
  114. # FTP Package names e.g.  sco-sniff.tar solaris-sniff.tgz
  115. set nl_sniff_package    = "sniff.tar"
  116. set nl_gnubin_package    = "gnubin.tar"
  117. set nl_gnusrc_package    = "gnusrc.tar"
  118.  
  119. # FlexLM file names
  120. set flex_files = (lmutil lmdown lmgrd lmhostid lmremove lmreread lmstat lmver takefive)
  121.  
  122. #
  123. set pid            = $$
  124. set tmp_script        = "/tmp/.scantar.$pid"
  125. set tmperr        = "/tmp/.stderrout.$pid"
  126. set common_install  = 0
  127. set visaj_install   = 0
  128. set bin_install        = 0
  129. set doc_install     = 0
  130. set exa_install     = 0
  131. set vim_bin_install = 0
  132. set sniff_avail     = 0
  133. set sniff_avails    = ()
  134. set one_sniff_avail = 0
  135. set gnubin_avail    = 0
  136. set gnusrc_avail    = 0
  137.  
  138. if ($?user == 0) then
  139.     if ($?USER == 0) then
  140.         echo "Please enter your user name: " | awk ' { printf "%s", $0 }'
  141.         set user = `/bin/sh -c 'read a; echo $a'`
  142.         if ("$user" == "") then
  143.             goto quit
  144.         endif
  145.     else
  146.         set user = $USER
  147.     endif
  148. endif
  149.  
  150. #
  151. #    Check kit, get name format
  152. #
  153. @ iname = 1
  154. foreach i ($nl_install)
  155.     if ( -f ./$i ) then
  156.     break
  157.     endif
  158.     @ iname = $iname + 1
  159. end
  160. if ( "$iname" > "3" ) then
  161.     echo "Your current working directory doesn't contain the file install.kit"
  162.     echo "Please change to the directory containing the SNiFF+ packages and try again."
  163.     echo ""
  164.     goto quit
  165. endif
  166.  
  167. start_install:
  168. clear
  169. echo ""
  170. echo "                   SNiFF+ $SNiFFversion installation procedure"
  171. echo "             Copyright (c) 1993-1999 TakeFive Software GmbH."
  172. echo "                            All rights reserved."
  173. select_installation:
  174. echo ""
  175. echo "Please select:"
  176. echo ""
  177. echo "  [A]   Install SNiFF+ binaries"
  178. echo "  [B]   Install GNU binaries"
  179. echo "  [C]   Install FlexLM binaries"
  180. echo ""
  181. echo "  [X]   Exit installation"
  182. echo ""
  183. echo "Your selection: " | awk '{ printf "%s", $0 }'
  184. set selection = `/bin/sh -c 'read a; echo $a'`
  185. switch("$selection")
  186.     case [aA]*:
  187.     set selection = 1
  188.     breaksw
  189.     case [bB]*:
  190.     set selection = 2
  191.     breaksw
  192.     case [cC]*:
  193.     set selection = 3
  194.     breaksw
  195.     case [xX]*:
  196.     goto quit
  197.     breaksw
  198.     default:
  199.     goto select_installation
  200. endsw
  201.  
  202. set kitdirs = ()
  203. set kit_archs  = ()
  204. set iarchs = ()
  205. set selected = ()
  206. set iarch = 1
  207.  
  208. # SOLARIS_ONLY
  209. if ($selection >= 1) then
  210.     set kitdirs = ($nl_solarisdir[$iname])
  211.     set kit_archs  = $solarisdir
  212.     set iarchs = 1
  213.     set instdir = $nl_solarisdir[$iname]
  214.     set inst_arch = $solarisdir
  215.     switch (`uname -m`@`uname -s`@`uname -r`)
  216.         case sun4*@SunOS@5.*:
  217.             goto end_ask_platform
  218.             breaksw
  219.         default:
  220.             echo ""
  221.             echo "You need to install this package on solaris."
  222.             echo ""
  223.             exit 1
  224.     endsw
  225. endif
  226.  
  227. if ($selection > 1) goto enter_install_platform
  228.  
  229. echo ""
  230. echo ""
  231. echo "SNiFF+ can be installed for multiple platforms in one directory. It is also"
  232. echo "possible to install a SNiFF+ kit for a platform which is not the installation"
  233. echo "platform. Therefore, please select first the target platforms"
  234. echo "and then the installation platform."
  235. echo ""
  236.  
  237. enter_platform:
  238. echo ""
  239. echo "Enter the platform(s) for which you want to install SNiFF+:"
  240. echo ""
  241. echo "sunos       for Sun SPARC machines running SunOS4 (Solaris 1.x)"
  242. echo "solaris     for Sun SPARC machines running SunOS5 (Solaris 2.x)"
  243. echo "aix         for IBM Risc machines running AIX 4.x"
  244. echo "hpux        for HP 9000/7XX machines running HP-UX 10.x/11.x"
  245. echo "decalpha    for DEC/alpha machines running Digital UNIX 3.x/4.x"
  246. echo "irix        for SGI machines running IRIX 5.3 or later"
  247. echo "unixware    for PC's running SCO Unixware 7.x/2.x or OpenServer 5.x"
  248. echo "linux-glibc for PC's running Linux 2.x based on GNU glibc 2.1 (like RedHat 6.x)"
  249. echo "sinix       for SNI RM machines running Reliant Unix 5.4x"
  250. echo ""
  251. echo "Enter one name at a time (Leave empty to finish the selection)."
  252. echo ""
  253.  
  254. set end = 0
  255. while (! $end)
  256.     echo "Target platform number $iarch : " | awk ' { printf "%s", $0 }'
  257.     set platform = `/bin/sh -c 'read a; echo $a'`
  258.     @ plus = 1
  259.     switch("$platform")
  260.     case quit:
  261.         goto quit
  262.     case sunos:
  263.         set kitdirs = ($kitdirs $nl_sundir[$iname])
  264.         set kit_archs  = ($kit_archs $sundir)
  265.         breaksw
  266.  
  267.     case solaris:
  268.         set kitdirs = ($kitdirs $nl_solarisdir[$iname])
  269.         set kit_archs  = ($kit_archs $solarisdir)
  270.         breaksw
  271.  
  272.     case hpux:
  273.         set kitdirs = ($kitdirs $nl_hpriscdir[$iname])
  274.         set kit_archs  = ($kit_archs $hpriscdir)
  275.         breaksw
  276.  
  277.     case decalpha:
  278.         set kitdirs= ($kitdirs $nl_osfdir[$iname])
  279.         set kit_archs = ($kit_archs $osfdir)
  280.         breaksw
  281.  
  282.     case aix:
  283.         set kitdirs= ($kitdirs $nl_ibmrsdir[$iname])
  284.         set kit_archs = ($kit_archs $ibmrsdir)
  285.         breaksw
  286.  
  287.     case irix:
  288.         set kitdirs= ($kitdirs $nl_irixdir[$iname])
  289.         set kit_archs = ($kit_archs $irixdir)
  290.         breaksw
  291.  
  292.     case sco:
  293.         set kitdirs= ($kitdirs $nl_scodir[$iname])
  294.         set kit_archs = ($kit_archs $scodir)
  295.         breaksw
  296.  
  297.     case linux-glibc:
  298.         set kitdirs= ($kitdirs $nl_linux_rh_dir[$iname])
  299.         set kit_archs = ($kit_archs $linux_rh_dir)
  300.         breaksw
  301.  
  302.     case unixware:
  303.         set kitdirs= ($kitdirs $nl_usldir[$iname])
  304.         set kit_archs= ($kit_archs $usldir)
  305.         breaksw 
  306.  
  307.     case sinix:
  308.         set kitdirs= ($kitdirs $nl_sinixdir[$iname])
  309.         set kit_archs= ($kit_archs $sinixdir)
  310.         breaksw 
  311.  
  312.     case ncr:
  313.         set kitdirs= ($kitdirs $nl_ncrdir[$iname])
  314.         set kit_archs= ($kit_archs $ncrdir)
  315.         breaksw 
  316.  
  317.     default:
  318.         if ("$platform" == "") then
  319.         if ("$kitdirs" == "") then
  320.             echo ""
  321.             echo "Please select at least one platform."
  322.             echo "Enter 'quit' to exit Installation."
  323.             echo ""
  324.         else
  325.             set end = 1
  326.         endif
  327.         else
  328.         echo ""
  329.         echo "You have selected an invalid platform name: $platform"
  330.         echo "Please retry"
  331.         echo ""
  332.         endif
  333.         set plus = 0
  334.         breaksw
  335.     endsw
  336.     if ($plus == 1) then
  337.     set iarchs = ($iarchs $iarch)
  338.     set selected = ($selected $platform)
  339.     endif
  340.     @ iarch = $iarch + $plus
  341. end
  342.  
  343. if ("$kitdirs" == "") then
  344.     echo ""
  345.     echo "Please select at least one platform."
  346.     echo ""
  347.     goto enter_platform
  348. endif
  349.  
  350. echo ""
  351. echo ""
  352. echo "The following platforms have been selected for installation:"
  353. echo ""
  354. foreach iarch ($iarchs)
  355.     echo "     $selected[$iarch]"
  356. end
  357. echo ""
  358. echo "Selection OK [y]? " | awk ' { printf "%s", $0 }'
  359. set cmsg = `/bin/sh -c 'read a; echo $a'`
  360. if ("$cmsg" == "") then
  361.     set cmsg = "y"
  362. endif
  363. switch("$cmsg")
  364.     case [nN]*:
  365.     goto enter_platform
  366. endsw
  367.  
  368. set imsg = $selected[1]
  369.  
  370. enter_install_platform:
  371. if (! $?imsg) then
  372.     set imsg = ""
  373. endif
  374. echo ""
  375. echo ""
  376. echo "Install from one of the following platforms:"
  377. echo ""
  378. echo "sunos       for Sun SPARC machines running SunOS4 (Solaris 1.x)"
  379. echo "solaris     for Sun SPARC machines running SunOS5 (Solaris 2.x)"
  380. echo "aix         for IBM Risc machines running AIX 4.x"
  381. echo "hpux        for HP 9000/7XX machines running HP-UX 10.x/11.x"
  382. echo "decalpha    for DEC/alpha machines running Digital UNIX 3.x/4.x"
  383. echo "irix        for SGI machines running IRIX 5.3 or later"
  384. echo "unixware    for PC's running SCO Unixware 7.x/2.x or OpenServer 5.x"
  385. echo "linux-glibc for PC's running Linux 2.x based on GNU glibc 2.1 (like RedHat 6.x)"
  386. echo "sinix       for SNI RM machines running Reliant Unix 5.4x"
  387. echo ""
  388. echo "Which one is your installation platform [$imsg]? " | awk ' { printf "%s", $0 }'
  389. set cmsg = `/bin/sh -c 'read a; echo $a'`
  390.  
  391. if ( "$cmsg" == "" ) then
  392.     set cmsg = $imsg
  393. endif
  394.  
  395. switch ("$cmsg") 
  396.     case sunos:
  397.         set instdir = $nl_sundir[$iname]
  398.         set inst_arch = $sundir
  399.         breaksw
  400.  
  401.     case solaris:
  402.         set instdir = $nl_solarisdir[$iname]
  403.         set inst_arch = $solarisdir
  404.         breaksw
  405.  
  406.     case hpux:
  407.         set instdir = $nl_hpriscdir[$iname]
  408.         set inst_arch = $hpriscdir
  409.         breaksw
  410.  
  411.     case decalpha:
  412.         set instdir = $nl_osfdir[$iname]
  413.         set inst_arch = $osfdir
  414.         breaksw
  415.  
  416.     case aix:
  417.         set instdir = $nl_ibmrsdir[$iname]
  418.         set inst_arch = $ibmrsdir
  419.         breaksw        
  420.  
  421.     case irix:
  422.         set instdir = $nl_irixdir[$iname]
  423.         set inst_arch = $irixdir
  424.         breaksw
  425.  
  426.     case sco:
  427.         set instdir = $nl_scodir[$iname]
  428.         set inst_arch = $scodir
  429.         breaksw
  430.  
  431.     case linux-glibc:
  432.         set instdir = $nl_linux_rh_dir[$iname]
  433.         set inst_arch = $linux_rh_dir
  434.         breaksw
  435.     
  436.     case unixware:
  437.         set instdir = $nl_usldir[$iname]
  438.         set inst_arch = $usldir
  439.         breaksw
  440.  
  441.     case sinix:
  442.         set instdir = $nl_sinixdir[$iname]
  443.         set inst_arch = $sinixdir
  444.         breaksw
  445.  
  446.     case ncr:
  447.         set instdir = $nl_ncrdir[$iname]
  448.         set inst_arch = $ncrdir
  449.         breaksw
  450.  
  451.     default:
  452.         echo ""
  453.         echo "You have selected an invalid platform name."
  454.         echo ""
  455.         goto enter_install_platform
  456. endsw
  457.  
  458. # SOLARIS_ONLY 
  459. end_ask_platform:
  460. set path = ($kitroot/$instdir $path)
  461. cd $kitroot 
  462.  
  463. if ($selection == 2) goto test_gnu_package
  464.  
  465. if ("$iarchs" == "") then
  466.     set iarchs = (1)
  467.     set kit_archs = ($inst_arch)
  468.     set kitdirs = ($instdir)
  469. endif 
  470.  
  471. # use vanilla tar of system 
  472. # extract tar from package (if available)
  473.  
  474. set one_vim_avail = 0
  475.  
  476. foreach iarch ($iarchs)
  477.     set kitdir = $kitdirs[$iarch]
  478.     set kit_arch = $kit_archs[$iarch]
  479.     set sniff_avail = 0 
  480.     if ( -f ./$kitdir/$nl_sniffbin[$iname] )  then
  481.     set sniff_avail = 1
  482.     else 
  483.     if ( -f ./$kitdir-$nl_sniff_package ) then
  484.         set sniff_avail = 1
  485.         
  486.         echo ""
  487.         echo "Preparing package: SNiFF+ for $kit_arch"
  488.         echo "This may take several minutes, depending on your machine."
  489.         
  490.         if (! -f $instdir/tar) then 
  491.         tar -xf ./$instdir-$nl_sniff_package $instdir/tar >& /dev/null
  492.         endif
  493.         if ( -f $instdir/tar) then
  494.             $instdir/tar -xo --exclude $instdir/tar -f ./$kitdir-$nl_sniff_package > /dev/null
  495.         else 
  496.             tar -xopf ./$kitdir-$nl_sniff_package > /dev/null
  497.         endif
  498.     else 
  499.         echo ""
  500.         echo "Your current working directory doesn't contain SNiFF+ for $kit_arch."
  501.         echo "There must be a subdirectory '$kitdir' in your current working directory."
  502.         echo "If you are installing from tape, then you must copy the directory '$kitdir'"
  503.         echo "from the tape."
  504.         echo ""
  505.     endif
  506.     endif
  507.     set vim_avail = 0
  508.     if ($sniff_avail && (-f ./$kitdir/$nl_vimbin[$iname])) then
  509.     set vim_avail = 1
  510.     endif
  511.     set sniff_avails = ($sniff_avails $sniff_avail)
  512.     @ one_sniff_avail = ($one_sniff_avail || $sniff_avail)
  513.     @ one_vim_avail = ($one_vim_avail || $vim_avail)
  514. end 
  515.  
  516. set visaj_avail = 0
  517. if (-f ./$nl_visaj[$iname]) then
  518.     set visaj_avail = 1
  519. endif
  520.  
  521. goto get_gzcat
  522.  
  523. # check GNU and JDK packages
  524. test_gnu_package:
  525. set gnubin_avail = 0
  526. if ( -f ./$instdir/$nl_gccbin[$iname] ) then
  527.     set gnubin_avail = 1
  528. else 
  529.     if ( -f ./$instdir-$nl_gnubin_package ) then
  530.     set gnubin_avail = 1
  531.     
  532.     echo ""
  533.     echo "Preparing package: GNU binaries for $inst_arch"
  534.     echo "This may take several minutes, depending on your machine."
  535.     if (! -f $instdir/tar) then 
  536.         tar -xf ./$instdir-$nl_gnubin_package $instdir/tar >& /dev/null
  537.     endif
  538.     if ( -f $instdir/tar) then
  539.         ./$instdir/tar -xo --exclude $instdir/tar -f ./$instdir-$nl_gnubin_package > /dev/null
  540.     else 
  541.         tar -xopf ./$instdir-$nl_gnubin_package > /dev/null
  542.     endif
  543.     else
  544.     echo ""
  545.     echo "Your current working directory doesn't contain binaries of GNU"
  546.     echo "gcc-$gccversion, gdb-$gdbversion, libg++-$libgversion, rcs-$rcsversion"
  547.     echo "and make-$mk_version for $inst_arch."    
  548.     echo ""
  549.     endif
  550. endif
  551.  
  552. if ( -f ./$nl_gnusrcdir[$iname]/$nl_gcc[$iname] ) then
  553.     set gnusrc_avail = 1
  554. else 
  555.     if ( -f ./$nl_gnusrc_package ) then
  556.     set gnusrc_avail = 1
  557.     
  558.     echo ""
  559.     echo "Preparing package: GNU sources."
  560.     echo "This may take several minutes, depending on your machine."
  561.     if ( -f $instdir/tar) then
  562.         ./$instdir/tar -xopf ./$nl_gnusrc_package > /dev/null
  563.     else     
  564.         tar -xopf ./$nl_gnusrc_package > /dev/null
  565.     endif
  566. #    else 
  567. #    echo ""
  568. #    echo "Your current working directory doesn't contain GNU source packages"
  569. #    echo "of gcc-$gccversion, gdb-$gdbversion, libg++-$libgversion, rcs-$rcsversion, make-$mk_version."
  570. #    echo ""
  571.     endif
  572. endif
  573.  
  574. set jdk_avail = 0
  575. if (-f ./$nl_jdkdir[$iname]/$instdir/$nl_jdk[$iname]) then
  576.     set jdk_avail = 1
  577. endif
  578.  
  579. get_gzcat:
  580. # check for gzcat and tar
  581. # search again format list
  582. @ gname = 1
  583. foreach i ($nl_zcat)
  584.     if ( -f $kitroot/$instdir/$i ) then
  585.     break
  586.     endif
  587.     @ gname = $gname + 1
  588. end
  589. if ( "$gname" > $#nl_zcat ) then
  590.     @ gname = 2
  591.     set gz = $nl_zcat[$gname]
  592. else
  593.     set gz = $kitroot/$instdir/$nl_zcat[$gname]
  594. endif
  595.  
  596. $gz -h >& /dev/null
  597. if ( $status != 0 ) then
  598.     if ( -f $kitroot/$instdir/$nl_zcat[$gname] ) then
  599.         chmod 755 $kitroot/$instdir/$nl_zcat[$gname] >& /dev/null
  600.         if ( ! -x $kitroot/$instdir/$nl_zcat[$gname] ) then
  601.         echo ""
  602.         echo Cannot set execute permission on $kitroot/$instdir/$nl_zcat[$gname]
  603.         echo This program is needed to uncompress the patch.
  604.         echo Please set execute permission on that program and then
  605.         echo restart this script.
  606.         goto quit
  607.         endif
  608.     else        
  609. # no gzcat found anywhere
  610.         echo ""
  611.         echo "$nl_zcat[$gname] could not be found in the path or in $kitroot/$instdir/."
  612.         echo "This program is needed to uncompress the patch. You may download a precompiled"
  613.         echo "version from our FTP server as described in the README file."
  614.         goto quit
  615.     endif
  616. endif
  617. # search again the correct tar
  618. @ gname = 1
  619. foreach i ($nl_tar)
  620.     if ( -f $kitroot/$instdir/$i ) then
  621.         break
  622.     endif
  623.     @ gname = $gname + 1
  624. end
  625. if ( "$gname" > $#nl_tar ) then
  626.     @ gname = 2
  627. endif
  628.  
  629. if ( -f $kitroot/$instdir/$nl_tar[$gname] ) then
  630.     chmod 755 $kitroot/$instdir/$nl_tar[$gname] >& /dev/null
  631.     if ( ! -x $kitroot/$instdir/$nl_tar[$gname] ) then
  632.         set gtar=$nl_tar[2]
  633.     else
  634.         set gtar=$kitroot/$instdir/$nl_tar[$gname]
  635.     endif
  636. else 
  637.     set gtar=$nl_tar[2]
  638. endif
  639.  
  640. if ($selection == 2) goto select_gnu
  641. if ($selection == 3) goto install_flexlm
  642.  
  643. select_sniff:
  644. if ( $one_sniff_avail == 0) then
  645.     echo ""
  646.     echo "Your current working directory doesn't contain packages to install."
  647.     echo "Please change to the directory containing the SNiFF+ packages and try again."
  648.     echo ""
  649.     goto quit
  650. endif
  651.  
  652. echo ""
  653. echo "This procedure will install SNiFF+ for:"
  654. echo ""
  655. foreach iarch ($iarchs)
  656.     if ( $sniff_avails[$iarch] ) then
  657.     echo "    $kit_archs[$iarch]"
  658.     endif
  659. end
  660. echo ""
  661. echo "You will have to enter the full pathname of the directory where SNiFF+"
  662. echo "should be installed in. If the directory does not exist then the procedure"
  663. echo "will create it. The following packages are included on the media:"
  664. echo ""
  665.  
  666. if ( $one_sniff_avail ) then 
  667.     echo "      - SNiFF+ $SNiFFversion core product" 
  668. endif
  669. if ( $visaj_avail ) then
  670.     echo "      - VisaJ GUI Builder for SNiFF+J"
  671. endif
  672.  
  673. if (-f ./$nl_docfiles[$iname]) then
  674.     echo "      - SNiFF+ documentation in PostScript format" 
  675. endif
  676.  
  677. if ( $one_sniff_avail ) then 
  678.     echo "      - Example sources for the tutorials including ET++" 
  679. endif
  680. if ( $one_vim_avail ) then 
  681.     echo "      - Vim 5.0 Vi Improved by Bram Moolenar" 
  682. endif
  683.  
  684. #################### Check installation environment ########################### 
  685. #
  686. #     Define root directory
  687. #
  688. get_rootdir:
  689. echo ""
  690. echo 'Please enter the absolute pathname of the SNiFF+ root directory:'
  691. echo ""
  692. echo '> ' | awk ' { printf "%s", $0 }'
  693. set rootdir = `/bin/sh -c 'read a; echo $a'`
  694. echo ""
  695. if ("$rootdir" == "") then
  696.     echo "You must specify the directory where SNiFF+ is to be located."
  697.     goto get_rootdir
  698. endif
  699.  
  700. if ( `echo $rootdir | awk '{printf "%s",substr($1,1,1)}'` != "/" ) then
  701.     echo "Please enter an absolute pathname like /usr/SNiFF ..."
  702.     goto get_rootdir
  703. endif
  704.  
  705. echo "Install SNiFF+ in directory $rootdir? [y] " | awk ' { printf "%s", $0 }'
  706. set c = `/bin/sh -c 'read a; echo $a'`
  707. if ("$c" == "")    set c = "y"
  708. switch("$c")
  709.     case    [nN]*:
  710.         goto get_rootdir
  711. endsw
  712.  
  713. if ( "$rootdir" == "/" ) then
  714. # some shells dont like it
  715.     set tmprootdir = '/.'
  716. else 
  717.     set tmprootdir = $rootdir
  718. endif
  719.  
  720. if ( !(-d $tmprootdir) ) then
  721.     echo "$rootdir does not exist.  Would you like to create it? [y] " | awk ' { printf "%s", $0 }'
  722.     set c = `/bin/sh -c 'read a; echo $a'`
  723.     if ("$c" == "")    set c = "y"
  724.     switch("$c")
  725.     case    [nN]*:
  726.         goto get_rootdir
  727.     default:
  728.         mkdir -p $rootdir
  729.         chmod 755 $rootdir
  730.         if (!(-d $rootdir)) then
  731.             echo "Could not create $rootdir (maybe missing permission?), please try again."
  732.             goto quit
  733.         endif
  734.     endsw
  735. endif
  736. #
  737. #    check write permission on rootdir 
  738. #
  739. touch $rootdir/t_e_s_t >& /dev/null
  740. if ( !(-f $rootdir/t_e_s_t) ) then
  741.     echo ""
  742.     echo "You do not have write permission on $rootdir."
  743.     echo ""
  744.     goto quit
  745. endif
  746. /bin/rm $rootdir/t_e_s_t >& /dev/null
  747.  
  748. #################################################################################
  749. #                Customize SNiFF+                #
  750. #################################################################################
  751. echo ""
  752. echo "You will be asked for each single package whether you would like to install it."
  753. echo "After displaying the size of the software selected for loading,"
  754. echo "the procedure will install the packages, which takes several minutes."
  755. echo "If you are installing as superuser, then you will be asked for the name"
  756. echo "and the group of the user who should be the owner of the current installation."
  757. set common_overwrite = 0
  758. set common_asked = 0
  759. set visaj_asked = 0
  760. set exa_asked = 0
  761. set doc_asked = 0
  762. set one_bin_install = 0
  763. set one_vim_install = 0
  764. set l_bin_install = ()
  765. set l_vim_bin_install = ()
  766. set l_bin_size = ()
  767. set l_vim_bin_size = ()
  768.  
  769. foreach iarch ($iarchs)
  770.     set bin_install = 0
  771.     set vim_bin_install = 0
  772.     set size_SNiFF = 0
  773.     set size_bin_exa = 0
  774.     set size_bin_vim = 0
  775.     set kitdir = $kitdirs[$iarch]
  776.     set kit_arch = $kit_archs[$iarch]
  777.     echo ""
  778.     echo ""
  779.     echo "=========================================================================="
  780.     echo "    Select packages for target platform: $kit_arch"
  781.     echo "=========================================================================="
  782.     if ((-f $kitroot/$nl_sniffcommon[$iname]) && (-f $kitroot/$kitdir/$nl_sniffbin[$iname])) then
  783.     set size_common_SNiFF = `$gz -l < $kitroot/$nl_sniffcommon[$iname] | fgrep stdout | awk '{printf ("%d", $2/975)}'`
  784.     set size_SNiFF = `$gz -l < $kitroot/$kitdir/$nl_sniffbin[$iname] | fgrep stdout | awk '{printf ("%d", $2/975)}'`
  785.     set size = "$size_SNiFF KB"
  786.     if (! $common_asked) then
  787.         set size =  "$size_common_SNiFF KB + $size"
  788.     endif
  789.     ask_for_bin:
  790.     set empty = ""
  791.     echo    ""
  792.     echo    ""
  793.     echo     "The media contains SNiFF+ $SNiFFversion for your system ($kit_arch)."
  794.     echo "Would you like to install it in $rootdir ($size)? [y] " | awk ' { printf "%s", $0 }'
  795.     set c = `/bin/sh -c 'read a; echo $a'`
  796.     if ("$c" == "")    set c = "y"
  797.     switch("$c")
  798.         case [nN]*:
  799.         set bin_install = '0'
  800.         breaksw
  801.         case [yY]*:
  802.         if ( ! $common_asked ) set common_install = 1
  803.         set bin_install = '1'
  804.         breaksw
  805.     default:
  806.         goto ask_for_bin
  807.     endsw
  808.     
  809.     if (-f $rootdir/Version) then
  810.             set SNIFF_VER = `cat $rootdir/Version`
  811.     else
  812.             set SNIFF_VER = SNiFF+
  813.     endif
  814.  
  815.     if ((! $common_asked) && ("$common_install" == '1') && (-f $rootdir/bin/sniff)) then
  816.         echo "Common part of $SNIFF_VER is already installed in directory $rootdir."
  817.         echo "Would you like to overwrite it? [n] " | awk ' { printf "%s", $0 }'
  818.         set c = `/bin/sh -c 'read a; echo $a'`
  819.         if ("$c" == "")    set c = "n"
  820.         switch("$c")
  821.         case [yY]*:
  822.             set common_overwrite = 1
  823.             breaksw
  824.         default:
  825.             set common_install = '0'
  826.         endsw
  827.         
  828.         if (-f $rootdir/Version) then
  829.             set version_in_file=`cat $rootdir/Version|cut -d" " -f2`
  830.             if ( "$SNiFFversion" == "$version_in_file") then 
  831.                 set same_version = 1
  832.             endif
  833.         endif
  834.     endif
  835.     set common_asked = 1
  836.     if (("$bin_install" == '1') && (-f $rootdir/bin/bin.$kit_arch/sniff)) then
  837.         echo "Binary part of $SNIFF_VER is already installed in directory $rootdir."
  838.         echo "Would you like to overwrite the $kit_arch binaries? [n] " | awk ' { printf "%s", $0 }'
  839.         set c = `/bin/sh -c 'read a; echo $a'`
  840.         if ("$c" == "") set c = "n"
  841.         switch("$c")
  842.         case    [yY]*:
  843.         set bin_install = 2    # means: overwrite existing installation
  844.                 breaksw
  845.         default:
  846.                 set bin_install = '0'
  847.         endsw
  848.     endif
  849.     endif
  850.  
  851. #################################### VisaJ ##################################
  852.     if ( ( ! $visaj_asked ) && ( -f $kitroot/$nl_visaj[$iname] ) ) then
  853.     set size_visaj = `$gz -l < $kitroot/$nl_visaj[$iname] | fgrep stdout | awk '{printf ("%d", $2/975)}'`
  854.     ask_for_visaj:
  855.     echo    ""
  856.     echo    ""
  857.     echo     "=========================================================================="
  858.     echo     "The media contains"
  859.     echo    "   VisaJ GUI Builder for SNiFF+J"
  860.     echo     ""
  861.     echo    "This tool is part of SNiFF+J."
  862.     echo    ""
  863.     set size = "$size_visaj KB"
  864.     echo "Install the files in $rootdir/$visajdir ($size)? [y] " | awk ' { printf "%s", $0 }'
  865.     set c = `/bin/sh -c 'read a; echo $a'`
  866.     if ("$c" == "")    set c = "y"
  867.     switch("$c")
  868.         case [nN]*:
  869.         set visaj_install = 0
  870.         breaksw
  871.         case [yY]*:
  872.         if ( ! $visaj_asked ) set visaj_install = 1
  873.         breaksw
  874.     default:
  875.         goto ask_for_example
  876.     endsw
  877.  
  878.     if ( ("$visaj_install" == '1') && (-d $rootdir/$visajdir)) then
  879.         echo "VisaJ GUI Builder is already installed in $rootdir/$visajdir"
  880.         echo "Would you like to overwrite it? [n] " | awk ' { printf "%s", $0 }'
  881.         set c = `/bin/sh -c 'read a; echo $a'`
  882.         if ("$c" == "")    set c = "n"
  883.         switch("$c")
  884.         case    [yY]*:
  885.         set visaj_install = 2
  886.             breaksw
  887.         default:
  888.             set visaj_install = '0'
  889.         endsw
  890.     endif
  891.     set visaj_asked = 1
  892.     endif
  893.  
  894.  
  895.  
  896. ##################################### Examples ##################################
  897.     if ( ( ! $exa_asked ) && ( -f $kitroot/$nl_examples[$iname] ) ) then
  898.     set size_com_exa = `$gz -l < $kitroot/$nl_examples[$iname] | fgrep stdout | awk '{printf ("%d", $2/975)}'`
  899.     ask_for_example:
  900.     set empty = ""
  901.     echo    ""
  902.     echo    ""
  903.     echo     "=========================================================================="
  904.     echo     "The media contains"
  905.     echo    "   Example sources for the tutorials including ET++"
  906.     echo     ""
  907.     echo    "These files are optional for using SNiFF+. They are needed only"
  908.     echo    'for working through the tutorials.'
  909.     echo    "This unsupported software is provided on an AS IS basis."
  910.     echo    ""
  911.     set size = "$size_com_exa KB"
  912.     echo "Install the files in $rootdir/example ($size)? [y] " | awk ' { printf "%s", $0 }'
  913.     set c = `/bin/sh -c 'read a; echo $a'`
  914.     if ("$c" == "")    set c = "y"
  915.     switch("$c")
  916.         case [nN]*:
  917.         set exa_install = 0
  918.         breaksw
  919.         case [yY]*:
  920.         if ( ! $exa_asked ) set exa_install = 1
  921.         breaksw
  922.     default:
  923.         goto ask_for_example
  924.     endsw
  925.  
  926.     if ( ("$exa_install" == '1') && (-f $rootdir/example/c++/filebrowser/filebrowser.C)) then
  927.         echo "Common part of the SNiFF+ example is already installed in directory $rootdir."
  928.         echo "Would you like to overwrite it? [n] " | awk ' { printf "%s", $0 }'
  929.         set c = `/bin/sh -c 'read a; echo $a'`
  930.         if ("$c" == "")    set c = "n"
  931.         switch("$c")
  932.         case    [yY]*:
  933.         set exa_install = 2
  934.             breaksw
  935.         default:
  936.             set exa_install = '0'
  937.         endsw
  938.     endif
  939.     set exa_asked = 1
  940.     endif
  941.  
  942. ##################################### VIM ##################################
  943.     if (-f $kitroot/$kitdir/$nl_vimbin[$iname]) then
  944.     set size_bin_vim = `$gz -l < $kitroot/$kitdir/$nl_vimbin[$iname] | fgrep stdout | awk '{printf ("%d", $2/975)}'`
  945.     ask_for_vim:
  946.     set empty = ""
  947.     echo    ""
  948.     echo    ""
  949.     echo     "=========================================================================="
  950.     echo     "The media contains the binaries for"
  951.     echo    "   Vim 5.0 (Vi Improved written by Bram Moolenar) -- vi like editor for SNiFF+"
  952.     echo     ""
  953.     echo    "These files are optional for using SNiFF+ and are not covered by the SNiFF+"
  954.     echo    "Support Agreement."
  955.     echo    ""
  956.     echo "Would you like to install the files in $rootdir ($size_bin_vim KB)? [y] " | awk ' { printf "%s", $0 }'
  957.     set c = `/bin/sh -c 'read a; echo $a'`
  958.     if ("$c" == "")    set c = "y"
  959.     switch("$c")
  960.         case [nN]*:
  961.         set vim_bin_install = '0'
  962.         breaksw
  963.         case [yY]*:
  964.         set vim_bin_install = '1'
  965.         breaksw
  966.     default:
  967.         goto ask_for_vim
  968.     endsw
  969.     if (("$vim_bin_install" == '1') && (-f $rootdir/bin/bin.$kit_arch/vim)) then
  970.         echo "Binary of the SNiFF+ vim is already installed in directory $rootdir."
  971.         echo "Would you like to overwrite the $kit_arch binaries? [n] " | awk ' { printf "%s", $0 }'
  972.         set c = `/bin/sh -c 'read a; echo $a'`
  973.         if ("$c" == "") set c = "n"
  974.         switch("$c")
  975.         case    [yY]*:
  976.             set vim_bin_install = 2
  977.             breaksw
  978.         default:
  979.             set vim_bin_install = '0'
  980.         endsw
  981.     endif
  982.     endif
  983.  
  984. ############################## Documentation ##################################
  985.     if (($doc_asked == 0) && (-f $kitroot/$nl_docfiles[$iname])) then
  986.     set size_doc = `$gz -l < $kitroot/$nl_docfiles[$iname] |  fgrep stdout | awk '{printf ("%d", $2/975)}'`
  987.     ask_for_doc:
  988.     set empty = ""
  989.     echo    ""
  990.     echo    ""
  991.     echo     "=========================================================================="
  992.     echo     "The media contains the whole SNiFF+ documentation in compressed"
  993.     echo    "PostScript format. The following documents are available:"
  994.     echo    "    Release Notes"
  995.     echo    "    Installation Guide"
  996.     echo    "    User's Guide"
  997.     echo    "    Reference Guide"
  998.     echo    "    Tutorials for C/C++/Java/Fortran"
  999.     echo     ""
  1000.     echo "Would you like to copy the files into $rootdir/doc ($size_doc KB)? [y] " | awk ' { printf "%s", $0 }'
  1001.     set c = `/bin/sh -c 'read a; echo $a'`
  1002.     if ("$c" == "") set c = "y"
  1003.     switch("$c")
  1004.     case    [nN]*:
  1005.         set doc_install = '0'
  1006.         breaksw
  1007.     case    [yY]*:
  1008.         set doc_install = '1'
  1009.         breaksw
  1010.     default:
  1011.         goto ask_for_doc
  1012.     endsw
  1013.     set doc_asked = 1
  1014.     endif
  1015.     clear
  1016.     @ one_bin_install = ($one_bin_install || $bin_install) 
  1017.     @ one_vim_install = ($one_vim_install || $vim_bin_install)
  1018.     set l_bin_install = ($l_bin_install $bin_install)
  1019.     set l_vim_bin_install = ($l_vim_bin_install $vim_bin_install)
  1020.     set l_bin_size = ($l_bin_size $size_SNiFF)
  1021.     set l_vim_bin_size = ($l_vim_bin_size $size_bin_vim)
  1022.     if ($iarch == 1) then
  1023.     @ sumMBroot = 0
  1024.     if ($common_install) then
  1025.         @ sumMBroot = $sumMBroot + $size_common_SNiFF
  1026.     endif
  1027.     if ($exa_install) then
  1028.         @ sumMBroot = $sumMBroot + $size_com_exa
  1029.     endif
  1030.     if ($doc_install) then
  1031.         @ sumMBroot = $sumMBroot + $size_doc
  1032.     endif
  1033.     if ($visaj_install) then
  1034.         @ sumMBroot = $sumMBroot + $size_visaj
  1035.     endif
  1036.     endif
  1037.     if ($bin_install) then
  1038.     @ sumMBroot = $sumMBroot + $size_SNiFF
  1039.     endif
  1040.     if ($vim_bin_install) then
  1041.     @ sumMBroot = $sumMBroot + $size_bin_vim
  1042.     endif
  1043. end    # foreach ($iarch ...)
  1044.   
  1045. if ($sumMBroot == 0) then
  1046.     goto quit
  1047. endif
  1048.  
  1049. @ sumMBroot = ($sumMBroot + 512) / 1024
  1050.  
  1051. echo ""
  1052. echo ""
  1053. echo     "=========================================================================="
  1054. echo "The following packages are selected for installation:"
  1055. echo ""
  1056. if ($common_install) then
  1057.     echo "      Common SNiFF+ $SNiFFversion ($size_common_SNiFF KB)"
  1058. endif
  1059. if ($one_bin_install) then
  1060.     echo "      Binary SNiFF+ $SNiFFversion for:"
  1061.     foreach iarch ($iarchs)
  1062.     if ($l_bin_install[$iarch]) then
  1063.         echo "             $kit_archs[$iarch]  ($l_bin_size[$iarch] KB)"
  1064.     endif
  1065.     end
  1066. endif
  1067. if ($visaj_install) then
  1068.     echo "      VisaJ GUI Builder for SNiFF+J ($size_visaj KB)"
  1069. endif
  1070. if ($doc_install) then
  1071.     echo "      SNiFF+ documentation in PostScript format ($size_doc KB)"
  1072. endif
  1073. if ($exa_install) then
  1074.     echo "      Example sources for the tutorials including ET++ ($size_com_exa KB)"
  1075. endif
  1076. if ($one_vim_install) then
  1077.     echo "      VIM binaries for:"
  1078.     foreach iarch ($iarchs)
  1079.     if ($l_vim_bin_install[$iarch]) then
  1080.         echo "             $kit_archs[$iarch]  ($l_vim_bin_size[$iarch] KB)"
  1081.     endif
  1082.     end
  1083. endif
  1084. echo ""
  1085. echo "=========================================================================="
  1086. if ($sumMBroot != 0) echo "$sumMBroot MB to be installed in $rootdir"
  1087.  
  1088. goto ask_for_install
  1089.  
  1090. #
  1091. #################################################################################
  1092. #                Customize GNU
  1093. #
  1094. #################################################################################
  1095. select_gnu:
  1096. if ( ($gnubin_avail == 0) && ($gnusrc_avail == 0) && ($jdk_avail == 0)) then
  1097.     echo ""
  1098.     echo "Your current working directory doesn't contain packages to install."
  1099.     echo "Please change to the directory containing the GNU packages"
  1100.     echo "and try again."
  1101.     echo ""
  1102.     goto quit
  1103. endif
  1104. echo "The following packages are included on the media:"
  1105. echo ""
  1106. if ( $gnubin_avail ) then
  1107.     echo "    - Binaries of GNU gcc-$gccversion, gdb-$gdbversion, libg++-$libgversion, rcs-$rcsversion"
  1108.     echo "      make-$mk_version" 
  1109. endif
  1110.  
  1111. if ( $gnusrc_avail ) then
  1112.     echo "    - GNU source packages of gcc-$gccversion, gdb-$gdbversion, libg++-$libgversion, rcs-$rcsversion,"
  1113.     echo "      make-$mk_version"
  1114. endif
  1115. if ( $jdk_avail ) then
  1116.     echo "    - Java Development Kit (JDK)"
  1117. endif
  1118.  
  1119. echo ""
  1120. echo "You will be asked for each single package whether you would like to install it."
  1121. echo "After displaying the size of the software selected for loading,"
  1122. echo "the procedure will install the packages, which takes several minutes."
  1123.  
  1124. mkdir -p `dirname $gnudir` >& /dev/null
  1125. chmod 755 `dirname $gnudir` >& /dev/null
  1126. mkdir $gnudir >& /dev/null
  1127. chmod 755 $gnudir >& /dev/null
  1128. touch $gnudir/g_n_u_t_e_s_t >& /dev/null
  1129. if ((-d $gnudir) && !(-f $gnudir/g_n_u_t_e_s_t)) then
  1130.     set no_perm = 1
  1131.     echo ""
  1132.     echo "WARNING: The GNU binaries supplied on the media (gcc,libg++,gdb,rcs,make)"
  1133.     echo "         must be installed in $gnudir on the local machine."
  1134.     echo "         You, "$user", do not have write permission on $gnudir."
  1135.     echo "         Please stop the installation and start it as superuser "
  1136.     echo "         if you want to install the GNU binaries."
  1137.     echo ""
  1138. ask_for_continue:
  1139.     echo "Continue with installation [y]? " | awk ' { printf "%s", $0 }'
  1140.     set c = `/bin/sh -c 'read a; echo $a'`
  1141.     if ("$c" == "") set c = "y"
  1142.     switch("$c")
  1143.     case    [nN]*:
  1144.         goto quit
  1145.     case    [yY]*:
  1146.         breaksw
  1147.     default:
  1148.         goto ask_for_continue
  1149.     endsw
  1150.  
  1151.  
  1152. endif
  1153. /bin/rm $gnudir/g_n_u_t_e_s_t >& /dev/null
  1154.  
  1155. #################### GNU executables and source packages  #########################
  1156. set gcc_install = '0'
  1157. set gdb_install = '0'
  1158. set rcs_install = '0'
  1159. set mk_install = '0'
  1160. set lib_install = '0'
  1161.  
  1162. echo    ""
  1163. echo    ""
  1164. echo     "=========================================================================="
  1165. echo     "The media contains executables of the GNU "
  1166. echo    "C++ compiler (gcc-$gccversion), the library (libg++-$libgversion),"
  1167. echo     "the debugger (gdb-$gdbversion), the GNU make tool (make-$mk_version)"
  1168. echo    "and the Revision Control System (rcs-$rcsversion)."
  1169. echo    ""
  1170. echo    "The installation of the GNU compiler and debugger is optional."
  1171. echo    "It is needed only if you do not have any another compiler/debugger."
  1172. echo    "The installation of the GNU library libg++ is optional."
  1173. echo    "The installation of the GNU make tool is optional."
  1174. echo    "The installation of the Revision Control System is optional."
  1175. echo    "The installation of the GNU library libg++ is optional."
  1176. echo    "SNiFF+ $SNiFFversion provides an interface to emacs 19 or later."
  1177. echo    ""
  1178. echo    "The GNU executables must be installed in the directory $gnudir."
  1179. echo     "If you do not want to install the ready-to-use GNU executables in $gnudir,"
  1180. echo     "then you can copy the GNU source packages from any GNU site and build and "
  1181. echo    "install the GNU tools according to your needs."
  1182.  
  1183. if ($no_perm) then
  1184.     echo ""
  1185.     echo "WARNING:  You cannot install in $gnudir because you do not have"
  1186.     echo "          write permission on it."
  1187.     echo ""
  1188.     #goto end_of_get_gnu
  1189. endif
  1190.  
  1191. ############################# GNU gcc ##############################
  1192. if (-f $kitroot/$instdir/$nl_gccbin[$iname]) then
  1193.     set size_gcc = `$gz -l < $kitroot/$instdir/$nl_gccbin[$iname] | fgrep stdout | awk '{printf ("%d", $2/975)}'`
  1194.     ask_for_gcc:
  1195.     set c = ""
  1196.     echo     ""
  1197.     echo "Install executables of gcc-$gccversion in $gnudir ($size_gcc KB)? [y] " | awk ' { printf "%s", $0 }'
  1198.     set c = `/bin/sh -c 'read a; echo $a'`
  1199.     if ("$c" == "") set c = "y"
  1200.     switch("$c")
  1201.     case    [nN]*:
  1202.         set gcc_install = '0'
  1203.         breaksw
  1204.     case    [yY]*:
  1205.         set gcc_install = '1'
  1206.         breaksw
  1207.     default:
  1208.         goto ask_for_gcc
  1209.     endsw
  1210. #
  1211. #    check existing GNU compiler
  1212. #
  1213.     if ("$gcc_install" == "1") then
  1214.         if (-d $gnudir/bin) then
  1215.             set compiler = ($gnudir/bin/[gG][cC][cC]*)
  1216.         else
  1217.             set compiler = "no_compiler"
  1218.         endif
  1219.         if (-f $compiler[1]) then
  1220.             echo ""
  1221.             echo "WARNING:"
  1222.             echo "    GNU compiler $compiler[1] is already installed."
  1223.             echo ""
  1224.             $compiler[1] -v
  1225.             echo ""
  1226.             echo "Replace it by gcc version $gccversion ? [n] " | awk ' { printf "%s", $0 }'
  1227.             set c = `/bin/sh -c 'read a; echo $a'`
  1228.             if ("$c" == "")    set c = "n"
  1229.             if ("$c" == "n" || "$c" == "N" || "$c" == "NO" || "$c" == "no") then
  1230.                 set gcc_install = "0"
  1231.             endif
  1232.         endif
  1233.     endif
  1234. endif
  1235. ############################# GNU libg++ ##############################
  1236. if (-f $kitroot/$instdir/$nl_libgarchive[$iname]) then
  1237.     set size_libg = `$gz -l < $kitroot/$instdir/$nl_libgarchive[$iname] | fgrep stdout | awk '{printf ("%d", $2/975)}'`
  1238.     ask_for_lib:
  1239.     set c = ""
  1240.     echo ""
  1241.     echo "Install libg++-$libgversion in $gnudir ($size_libg KB)? [y] " | awk ' { printf "%s", $0 }'
  1242.     set c = `/bin/sh -c 'read a; echo $a'`
  1243.     if ("$c" == "") set c = "y"
  1244.     switch("$c")
  1245.     case    [nN]*:
  1246.         set lib_install = '0'
  1247.         breaksw
  1248.     case    [yY]*:
  1249.         set lib_install = '1'
  1250.         breaksw
  1251.     default:
  1252.         goto ask_for_lib
  1253.     endsw
  1254.     #
  1255.     #    check existing GNU library
  1256.     #
  1257.     if ("$lib_install" == "1") then
  1258.         if (-d $gnudir/lib) then
  1259.             set library = ($gnudir/lib/libg++*.a)
  1260.         else
  1261.             set library = "no_compiler"
  1262.         endif
  1263.         if (-f $library[1]) then
  1264.             echo ""
  1265.             echo "WARNING:"
  1266.             echo "    GNU library $library[1] is already installed."
  1267.             echo ""
  1268.             echo "Replace it by libg++ version $libgversion ? [n] " | awk ' { printf "%s", $0 }'
  1269.             set c = `/bin/sh -c 'read a; echo $a'`
  1270.             if ("$c" == "")    set c = "n"
  1271.             if ("$c" == "n" || "$c" == "N" || "$c" == "NO" || "$c" == "no") then
  1272.                 set lib_install = "0"
  1273.             endif
  1274.         endif
  1275.     endif
  1276. endif
  1277.  
  1278. ############################# GNU gdb ##############################
  1279. if (-f $kitroot/$instdir/$nl_gdbbin[$iname]) then
  1280.     set size_gdb = `$gz -l < $kitroot/$instdir/$nl_gdbbin[$iname] | fgrep stdout | awk '{printf ("%d", $2/975)}'`
  1281.     ask_for_gdb:
  1282.     set c = ""
  1283.     echo ""
  1284.     echo  "Install executables of gdb-$gdbversion in $gnudir ($size_gdb KB)? [y] " | awk ' { printf "%s", $0 }'
  1285.     set c = `/bin/sh -c 'read a; echo $a'`
  1286.     if ("$c" == "") set c = "y"
  1287.     switch("$c")
  1288.     case    [nN]*:
  1289.         set gdb_install = '0'
  1290.         breaksw
  1291.     case    [yY]*:
  1292.         set gdb_install = '1'
  1293.         breaksw
  1294.     default:
  1295.         goto ask_for_gdb
  1296.     endsw
  1297.     #
  1298.     #     check existing GNU debugger
  1299.     #
  1300.     if ("$gdb_install" == "1") then
  1301.         if (-d $gnudir/bin) then
  1302.             set debugger = ($gnudir/bin/[gG][dD][bB]*)
  1303.         else
  1304.             set debugger =  "no_debugger"
  1305.         endif
  1306.         if (-f $debugger[1]) then
  1307.             echo ""
  1308.             echo "WARNING:"
  1309.             echo "    GNU debugger $debugger[1] is already installed."
  1310.             echo ""
  1311.             $debugger[1] -help | & sed '2,$d'
  1312.             echo ""
  1313.             echo "Replace it by gdb version $gdbversion ? [n] " | awk ' { printf "%s", $0 }'
  1314.             set c = `/bin/sh -c 'read a; echo $a'`
  1315.             if ("$c" == "")    set c = "n"
  1316.             if ("$c" == "n" || "$c" == "N" || "$c" == "NO" || "$c" == "no") then
  1317.                 set gdb_install = "0"
  1318.             endif
  1319.         endif
  1320.     endif
  1321. endif
  1322.  
  1323. ############################# GNU rcs ##############################
  1324. if (-f $kitroot/$instdir/$nl_rcsbin[$iname]) then
  1325.     set size_rcs = `$gz -l < $kitroot/$instdir/$nl_rcsbin[$iname] | fgrep stdout | awk '{printf ("%d", $2/975)}'`
  1326.     ask_for_rcs:
  1327.     set c = ""
  1328.     echo     ""
  1329.     echo  "Install executables of rcs-$rcsversion in $gnudir ($size_rcs KB)? [y] " | awk ' { printf "%s", $0 }'
  1330.     set c = `/bin/sh -c 'read a; echo $a'`
  1331.     if ("$c" == "") set c = "y"
  1332.     switch("$c")
  1333.     case    [nN]*:
  1334.         set rcs_install = '0'
  1335.         breaksw
  1336.     case    [yY]*:
  1337.         set rcs_install = '1'
  1338.         breaksw
  1339.     default:
  1340.         goto ask_for_rcs
  1341.     endsw
  1342.     #
  1343.     #    check existing RCS
  1344.     #
  1345.     if ("$rcs_install" == "1") then
  1346.         if (-d $gnudir/bin) then
  1347.             set rcs = ($gnudir/bin/rcs*)
  1348.         else
  1349.             set rcs = "no_rcs"
  1350.         endif
  1351.         if (-f $rcs[1]) then
  1352.             echo ""
  1353.             echo "WARNING:"
  1354.             echo "    RCS is already installed."
  1355.             echo ""
  1356.             echo "Replace it by rcs version $rcsversion ? [n] " | awk ' { printf "%s", $0 }'
  1357.             set c = `/bin/sh -c 'read a; echo $a'`
  1358.             if ("$c" == "")    set c = "n"
  1359.             if ("$c" == "n" || "$c" == "N" || "$c" == "NO" || "$c" == "no") then
  1360.                 set rcs_install = "0"
  1361.             endif
  1362.         endif
  1363.     endif
  1364. endif
  1365.  
  1366. ############################# GNU make ##############################
  1367. if (-f $kitroot/$instdir/$nl_mk_bin[$iname]) then
  1368.     set size_mk = `$gz -l < $kitroot/$instdir/$nl_mk_bin[$iname] | fgrep stdout | awk '{printf ("%d", $2/975)}'`
  1369.     ask_for_mk:
  1370.     set c = ""
  1371.     echo     ""
  1372.     echo  "Install executables of make-$mk_version in $gnudir ($size_mk KB)? [y] " | awk ' { printf "%s", $0 }'
  1373.     set c = `/bin/sh -c 'read a; echo $a'`
  1374.     if ("$c" == "") set c = "y"
  1375.     switch("$c")
  1376.     case    [nN]*:
  1377.         set mk_install = '0'
  1378.         breaksw
  1379.     case    [yY]*:
  1380.         set mk_install = '1'
  1381.         breaksw
  1382.     default:
  1383.         goto ask_for_mk
  1384.     endsw
  1385.     #
  1386.     #    check existing MAKE
  1387.     #
  1388.     if ("$mk_install" == "1") then
  1389.         if (-d $gnudir/bin) then
  1390.             set mk = ($gnudir/bin/*make)
  1391.         else
  1392.             set mk = ""
  1393.         endif
  1394.         if ("$mk" != "") then
  1395.             echo ""
  1396.             echo "WARNING:"
  1397.             echo "        GNU make is already installed."
  1398. # does not work with all make programms
  1399. #            $mk[0] -v
  1400.             echo ""
  1401.             echo "Replace it by make version $mk_version ? [n] " | awk ' { printf "%s", $0 }'
  1402.             set c = `/bin/sh -c 'read a; echo $a'`
  1403.             if ("$c" == "")    set c = "n"
  1404.             if ("$c" == "n" || "$c" == "N" || "$c" == "NO" || "$c" == "no") then
  1405.                 set mk_install = "0"
  1406.             endif
  1407.         endif
  1408.     endif
  1409. endif
  1410. end_of_get_gnu:
  1411.  
  1412. ############################# JDK ##############################
  1413. set jdk_install    = '0'
  1414. set jdkdir         = $HOME
  1415. set size_jdk       = 0
  1416.  
  1417. if (-f $kitroot/$nl_jdkdir[$iname]/$instdir/$nl_jdk[$iname]) then
  1418.     echo    ""
  1419.     echo     "=========================================================================="
  1420.     echo     "The media contains JDK for $inst_arch"
  1421.     echo    ""
  1422.     echo    "The installation of the JDK is optional."
  1423.     echo    "It is needed only if you are working with JAVA."
  1424.     echo    ""
  1425.  
  1426.     set size_jdk = `$gz -l < $kitroot/$nl_jdkdir[$iname]/$instdir/$nl_jdk[$iname] | fgrep stdout | awk '{printf ("%d", $2/975)}'`
  1427.  
  1428.     set c = ""
  1429.     echo     ""
  1430.     echo  "Install JDK for $inst_arch ($size_jdk KB)? [y] " | awk ' { printf "%s", $0 }'
  1431.     set c = `/bin/sh -c 'read a; echo $a'`
  1432.     if ("$c" == "") set c = "y"
  1433.     switch("$c")
  1434.     case    [nN]*:
  1435.         set jdk_install = '0'
  1436.         breaksw
  1437.     case    [yY]*:
  1438.         set jdk_install = '1'
  1439. get_jdkdir:
  1440.         echo ""
  1441.         echo 'Please enter the absolute pathname of the JDK install directory: ' | awk ' { printf "%s", $0 }'
  1442.         set jdkdir = `/bin/sh -c 'read a; echo $a'`
  1443.         echo ""
  1444.         if ("$jdkdir" == "") then
  1445.             echo "You must specify the directory where JDK is to be located."
  1446.             goto get_jdkdir
  1447.         endif
  1448.  
  1449.         if ( `echo $jdkdir | awk '{printf "%s",substr($1,1,1)}'` != "/" ) then
  1450.             echo ""
  1451.             echo "Please enter an absolute pathname like /usr/SNiFF ..."
  1452.             goto get_jdkdir
  1453.         endif
  1454.         echo ""
  1455.         echo "Install JDK in directory $jdkdir? [y] " | awk ' { printf "%s", $0 }'
  1456.         set c = `/bin/sh -c 'read a; echo $a'`
  1457.         if ("$c" == "")    set c = "y"
  1458.         switch("$c")
  1459.             case    [nN]*:
  1460.             goto get_jdkdir
  1461.         endsw
  1462.  
  1463.         if ( "$jdkdir" == "/" ) then
  1464.         # some shells dont like it
  1465.             set tmpjdkdir = '/.'
  1466.         else 
  1467.             set tmpjdkdir = $jdkdir
  1468.         endif
  1469.  
  1470.         if ( !(-d $tmpjdkdir) ) then
  1471.             echo "$jdkdir does not exist.  Would you like to create it? [y] " | awk ' { printf "%s", $0 }'
  1472.             set c = `/bin/sh -c 'read a; echo $a'`
  1473.             if ("$c" == "")    set c = "y"
  1474.                 switch("$c")
  1475.                     case    [nN]*:
  1476.                     goto get_jdkdir
  1477.                 default:
  1478.                 mkdir -p $jdkdir
  1479.                 chmod 755 $jdkdir
  1480.                 if (!(-d $jdkdir)) then
  1481.                     echo "Could not create $jdkdir (maybe missing permission?), please try again."
  1482.                     goto quit
  1483.                 endif
  1484.                 endsw
  1485.             endif
  1486.         #
  1487.         #    check write permission on jdkdir 
  1488.         #
  1489.         touch $jdkdir/t_e_s_t >& /dev/null
  1490.         if ( !(-f $jdkdir/t_e_s_t) ) then
  1491.             echo ""
  1492.             echo "You do not have write permission on $jdkdir."
  1493.             echo ""
  1494.             goto get_jdkdir
  1495.         endif
  1496.         /bin/rm $jdkdir/t_e_s_t >& /dev/null
  1497.         breaksw
  1498.     default:
  1499.     endsw
  1500. endif
  1501. end_of_get_jdk:
  1502.  
  1503. #
  1504. #    check size
  1505. #
  1506. @ sumMBgnu = $gcc_install * $size_gcc
  1507. @ sumMBgnu = $sumMBgnu + $lib_install * $size_libg + $gdb_install * $size_gdb
  1508. @ sumMBgnu = $sumMBgnu + $mk_install * $size_mk + $rcs_install * $size_rcs 
  1509. @ sumMBjdk = $jdk_install * $size_jdk
  1510. @ sumMB = $sumMBgnu + $sumMBjdk
  1511.  
  1512. if ($sumMB  == 0) then
  1513.     goto quit
  1514. endif
  1515.  
  1516. @ sumMBgnu = ($sumMBgnu + 512) / 1024
  1517. @ sumMBjdk = ($sumMBjdk + 512) / 1024
  1518.  
  1519. echo ""
  1520. echo ""
  1521. echo     "=========================================================================="
  1522. echo "The following packages are selected for installation:"
  1523. echo ""
  1524.  
  1525. if ($gcc_install) then
  1526.     echo "    executables of gcc-$gccversion ($size_gcc KB)"
  1527. endif
  1528. if ($lib_install) then
  1529.     echo "    archive file of libg++-$libgversion ($size_libg KB)"
  1530. endif
  1531. if ($gdb_install) then
  1532.     echo "    executables of gdb-$gdbversion ($size_gdb KB)"
  1533. endif
  1534. if ($rcs_install) then
  1535.     echo "    executables of rcs-$rcsversion ($size_rcs KB)"
  1536. endif
  1537. if ($mk_install)  then
  1538.     echo "    executables of make-$mk_version ($size_mk KB)"
  1539. endif
  1540. if ($jdk_install)  then
  1541.     echo "    Java Development Kit ($size_jdk KB)"
  1542. endif
  1543.  
  1544. echo ""
  1545. echo     "=========================================================================="
  1546. if ($sumMBgnu != 0) echo "$sumMBgnu MB to be installed in $gnudir"
  1547. if ($sumMBjdk != 0) echo "$sumMBjdk MB to be installed in $jdkdir"
  1548.  
  1549. ask_for_install:
  1550. set c = ""
  1551. echo ""
  1552. echo  "Continue with installation of the packages listed above? [y] " | awk ' { printf "%s", $0 }'
  1553. set c = `/bin/sh -c 'read a; echo $a'`
  1554. if ("$c" == "") set c = "y"
  1555. switch("$c")
  1556. case    [nN]*:
  1557.     goto quit
  1558.     breaksw
  1559. case    [yY]*:
  1560.     breaksw
  1561. default:
  1562.     goto ask_for_install
  1563. endsw
  1564.  
  1565. if ($selection == 1) goto install_sniff
  1566.  
  1567. #
  1568. #    check if gnudir does exist
  1569. #
  1570. if ((("$gcc_install" == "1") || ("$lib_install" == "1") || ("$gdb_install" == "1") || ("$rcs_install" == "1") || ("$mk_install" == "1")) && !(-d $gnudir)) then
  1571.     echo ""
  1572.     echo "$gnudir does not exist."
  1573.     echo "Would you like to create it? [y] " | awk ' { printf "%s", $0 }'
  1574.     set c = `/bin/sh -c 'read a; echo $a'`
  1575.     if ("$c" == "")    set c = "y"
  1576.     if ("$c" == "y" || "$c" == "Y" || "$c" == "YES" || "$c" == "yes") then
  1577.         mkdir -p $gnudir
  1578.         chmod a+rx $gnudir
  1579.         if (!(-d $gnudir)) then
  1580.             set gcc_install = '0'
  1581.             set gdb_install = '0'
  1582.             set rcs_install = '0'
  1583.             set mk_install = '0'
  1584.             set lib_install = '0'
  1585.             echo ""
  1586.             echo "Could not create $gnudir."
  1587.             echo "Skipping installation of selected GNU packages."
  1588.         endif
  1589.     else
  1590.         set gcc_install = '0'
  1591.         set gdb_install = '0'
  1592.         set rcs_install = '0'
  1593.         set mk_install = '0'
  1594.         set lib_install = '0'
  1595.         echo ""
  1596.         echo "Directory $gnudir not created."
  1597.         echo "Skipping installation of selected GNU packages."
  1598.     endif
  1599. endif
  1600. #
  1601. #   Install GNU and JDK
  1602. #
  1603.  
  1604. if ($gcc_install) then
  1605.     cd $gnudir
  1606.     echo "Installing executables of gcc-$gccversion in $gnudir ..."
  1607.     $gz -d -c < $kitroot/$instdir/$nl_gccbin[$iname] | cat | $gtar -xopf - > /dev/null
  1608. #    echo "Fixing standard system include files for gcc (takes 10 minutes or more) ..." 
  1609. #    sh ./fixincludes >& /dev/null
  1610. endif
  1611. if ($lib_install) then
  1612.     cd $gnudir
  1613.     echo "Installing libg++-$libgversion in $gnudir ..."
  1614.     $gz -d -c < $kitroot/$instdir/$nl_libgarchive[$iname] | cat | $gtar -xopf - > /dev/null
  1615. endif
  1616. if ($gdb_install) then
  1617.     cd $gnudir
  1618.     echo "Installing gdb-$gdbversion in $gnudir ..."
  1619.     $gz -d -c < $kitroot/$instdir/$nl_gdbbin[$iname] | cat | $gtar -xopf - > /dev/null
  1620. endif
  1621. if ($rcs_install) then
  1622.     cd $gnudir
  1623.     echo "Installing rcs-$rcsversion in $gnudir ..."
  1624.     $gz -d -c < $kitroot/$instdir/$nl_rcsbin[$iname] | cat | $gtar -xopf - > /dev/null
  1625. endif
  1626. if ($mk_install) then
  1627.     cd $gnudir
  1628.     echo "Installing make-$mk_version in $gnudir ..."
  1629.     $gz -d -c < $kitroot/$instdir/$nl_mk_bin[$iname] | cat | $gtar -xopf - > /dev/null
  1630. endif
  1631.  
  1632. if ($jdk_install) then
  1633.     cd $jdkdir
  1634.     echo "Installing JDK for $inst_arch in $jdkdir ..."
  1635.     $gz -d -c < $kitroot/$nl_jdkdir[$iname]/$instdir/$nl_jdk[$iname] | cat | $gtar -xopf - > /dev/null
  1636. endif
  1637.  
  1638. if (! ($gcc_install || $gdb_install || $rcs_install || $mk_install || $lib_install) ) goto endinstall
  1639. if ( ${?rootdir} ) then
  1640.     if ( "$rootdir" != "" ) then
  1641.     set sniffdir = $rootdir
  1642.     goto end_gnuinstall
  1643.     endif
  1644. endif
  1645. get_sniffdir:
  1646. echo ""
  1647. echo "The GNU public license text files will be copied to <sniff_dir>/gnu."
  1648. echo 'Please enter the absolute pathname of your SNiFF+ installation directory:'
  1649. get_sniffdir2:
  1650. echo ""
  1651. echo '> ' | awk ' { printf "%s", $0 }'
  1652. set sniffdir = `/bin/sh -c 'read a; echo $a'`
  1653. echo ""
  1654. if ("$sniffdir" == "") then
  1655.     echo "You must specify the directory to copy the files."
  1656.     goto get_sniffdir2
  1657. endif
  1658.  
  1659. if ( `echo $sniffdir | awk '{printf "%s",substr($1,1,1)}'` != "/" ) then
  1660.     echo "Please enter an absolute pathname like /usr/SNiFF ..."
  1661.     goto get_sniffdir2
  1662. endif
  1663.  
  1664. end_gnuinstall:
  1665. if (! -d $sniffdir/gnu) then
  1666.     mkdir $sniffdir/gnu >& /dev/null
  1667. endif 
  1668. if ($gcc_install || $gdb_install || $rcs_install || $mk_install) then
  1669.     cp $kitroot/$nl_copy[$iname] $sniffdir/gnu/COPYING >& /dev/null
  1670. endif
  1671. if ($lib_install) then
  1672.     cp $kitroot/$nl_copylib[$iname] $sniffdir/gnu/COPYING.LIB >& /dev/null
  1673. endif
  1674. if (-f $gnudir/bin/as.PTF-U416277) then
  1675.     echo ""
  1676.     echo "======================================================================"
  1677.     echo "NOTE:  There is a bug in the IBM assembler under some AIX versions."
  1678.     echo "       Please check your assembler whether the bug is fixed."
  1679.     echo "         The file $gnudir/README.gcc discribes how to test the assembler."
  1680.     echo "       Please read also the Release Notes."
  1681.     echo "       There is a fixed version of the assembler included on the SNiFF+ media."
  1682.     echo "         Please make a backup copy of /bin/as and"
  1683.     echo "       replace it with $gnudir/bin/as.PTF-U416277,"
  1684.     echo "         if your assembler does not include the fix."
  1685.     echo "======================================================================"
  1686. endif
  1687. goto endinstall
  1688. #
  1689. install_flexlm:
  1690. #
  1691. # ask for FlexLM installation directory
  1692. #
  1693. get_flexdir:
  1694. echo ""
  1695. echo 'Please enter the absolute pathname of the FlexLM root directory:'
  1696. echo ""
  1697. echo '> ' | awk ' { printf "%s", $0 }'
  1698. set flexdir = `/bin/sh -c 'read a; echo $a'`
  1699. echo ""
  1700. if ("$flexdir" == "") then
  1701.     echo "You must specify the directory where FlexLM is to be located."
  1702.     goto get_flexdir
  1703. endif
  1704.  
  1705. if ( `echo $flexdir | awk '{printf "%s",substr($1,1,1)}'` != "/" ) then
  1706.     echo "Please enter an absolute pathname like /usr/flexlm ..."
  1707.     goto get_flexdir
  1708. endif
  1709.  
  1710. echo "Install FlexLM in directory $flexdir? [y] " | awk ' { printf "%s", $0 }'
  1711. set c = `/bin/sh -c 'read a; echo $a'`
  1712. if ("$c" == "")    set c = "y"
  1713. switch("$c")
  1714.     case    [nN]*:
  1715.         goto get_flexdir
  1716. endsw
  1717.  
  1718. if ( "$flexdir" == "/" ) then
  1719. # some shells dont like it
  1720.     set tmpflexdir = '/.'
  1721. else 
  1722.     set tmpflexdir = $flexdir
  1723. endif
  1724.  
  1725. if ( !(-d $tmpflexdir) ) then
  1726.     echo "$flexdir does not exist.  Would you like to create it? [y] " | awk ' { printf "%s", $0 }'
  1727.     set c = `/bin/sh -c 'read a; echo $a'`
  1728.     if ("$c" == "")    set c = "y"
  1729.     switch("$c")
  1730.     case    [nN]*:
  1731.         goto get_flexdir
  1732.     default:
  1733.         mkdir -p $flexdir
  1734.         chmod 755 $flexdir
  1735.         if (!(-d $flexdir)) then
  1736.             echo "Could not create $flexdir (maybe missing permission?), please try again."
  1737.             goto quit
  1738.         endif
  1739.     endsw
  1740. endif
  1741. #
  1742. #    check write permission on flexdir 
  1743. #
  1744. touch $flexdir/t_e_s_t >& /dev/null
  1745. if ( !(-f $flexdir/t_e_s_t) ) then
  1746.     echo ""
  1747.     echo "You do not have write permission on $flexdir."
  1748.     echo ""
  1749.     goto quit
  1750. endif
  1751. /bin/rm $flexdir/t_e_s_t >& /dev/null
  1752.  
  1753. set flex_paths = ()
  1754. foreach flex_file ($flex_files)
  1755.     set flex_paths = ($flex_paths "bin/bin.$kit_arch/$flex_file")
  1756. end
  1757. if (-f $flexdir/bin/lmutil) then
  1758.     echo "FlexLM is already installed in $flexdir"
  1759.     echo "Would you like to overwrite the installation? [n] " | awk ' { printf "%s", $0 }'
  1760.     set c = `/bin/sh -c 'read a; echo $a'`
  1761.     if ("$c" == "") set c = "n"
  1762.     switch("$c")
  1763.     case [nN]*:
  1764.         goto quit
  1765.     case [yY]*:
  1766.         cd $flexdir/bin
  1767.         /bin/rm -f $flex_files
  1768.         breaksw
  1769.     endsw
  1770. endif
  1771. # unpack flexlm files 
  1772. cd $flexdir
  1773. $gz -d -c < $kitroot/$kitdir/$nl_sniffbin[$iname] | cat | $gtar -xopf - $flex_paths > /dev/null
  1774. # move files to bin directory and remove architecture directory
  1775. mv bin/bin.$kit_arch/* bin >& /dev/null
  1776. rmdir bin/bin.$kit_arch >& /dev/null
  1777. echo ""
  1778. echo "FlexLM has been successfully installed to $flexdir"
  1779. goto end
  1780. #
  1781. install_sniff:
  1782. ############################ Install packages #################################
  1783. #
  1784. #
  1785. # write temporary script
  1786. # deletes read-only files and symbolic links
  1787. while ( ( -e $tmp_script ) || { sh -c "test -h $tmp_script" } )
  1788.     set tmp_script = $tmp_script"_"
  1789. end
  1790. echo '#\!/bin/sh' > $tmp_script
  1791. echo 'if [ ! -w $1 ]; then rm -fr $1 > /dev/null; exit 0; fi' >> $tmp_script
  1792. echo 'if [ -h $1 ]; then rm -fr $1 > /dev/null; fi' >> $tmp_script
  1793. echo 'exit 0' >> $tmp_script
  1794. chmod 755 $tmp_script
  1795.  
  1796. #umask 0
  1797. echo ""
  1798. cd  $rootdir
  1799.  
  1800. echo ""
  1801. echo "Installing the selected packages."
  1802. echo "This may take several minutes for each package."
  1803. echo ""
  1804.  
  1805. if ( $common_install ) then
  1806.     #
  1807.     #    checking some files for presence, and copy them to *.old 
  1808.     #            
  1809.     if ( -f $rootdir/Version ) then
  1810.     if ( -f $rootdir/bin/sniff_wrapper ) then
  1811.         chmod 666 $rootdir/bin/sniff_wrapper >& /dev/null
  1812.     endif
  1813.     if ( -f $rootdir/Version ) then
  1814.         chmod 666 $rootdir/Version >& /dev/null
  1815.     endif
  1816.     set files_to_move = ( "Version" "SitePrefs.sniff" "license.dat" )
  1817.     set dirs_to_move = ( doc config icons lib make_support ws_support \
  1818.         Preferences integrations symbol_API )
  1819.     echo copying and moving some files, directories of the old version
  1820.     foreach file ($files_to_move)
  1821.         if ( -f $rootdir/$file ) then
  1822.         if ( -f $rootdir/$file.old ) then
  1823.             echo first removing $file.old
  1824.             rm -f $rootdir/$file.old
  1825.         endif
  1826.         echo copying $file to $file.old
  1827.         cp $rootdir/$file $rootdir/$file.old
  1828.         chmod 666 $rootdir/$file >& /dev/null
  1829.         endif
  1830.     end # foreach file
  1831.     #
  1832.     #    moving common existing sniff dirs to *.old
  1833.     #
  1834.     foreach dir ($dirs_to_move)
  1835.         if ( -d $rootdir/$dir ) then
  1836.         if ( -d $rootdir/$dir.old ) then
  1837.             echo current $dir.old will be overwritten
  1838.             rm -f -r $rootdir/$dir.old
  1839.         endif
  1840.         echo moving directory $dir to $dir.old
  1841.         mv -f $rootdir/$dir $rootdir/$dir.old
  1842.         endif
  1843.     end  # foreach dir
  1844.     echo ""
  1845.     endif
  1846.  
  1847.     echo "Installing common SNiFF+ $SNiFFversion ..."                    
  1848.     if ( $common_overwrite ) then
  1849.     # moving old workingenvs dir - will be restored afterwards
  1850.     mv $rootdir/workingenvs $rootdir/workingenvs.old
  1851.     $gz -d -c < $kitroot/$nl_sniffcommon[$iname] | cat | $gtar -tf - | awk '{print $1}' | xargs -i $tmp_script {}
  1852.     endif
  1853.     $gz -d -c < $kitroot/$nl_sniffcommon[$iname] | cat | $gtar -xopf - > /dev/null
  1854.     chmod 777 $rootdir/workingenvs/WEProjectCache >& /dev/null
  1855.     if ( $common_overwrite ) then
  1856.     mv $rootdir/workingenvs $rootdir/workingenvs.orig
  1857.     mv $rootdir/workingenvs.old $rootdir/workingenvs
  1858.     endif
  1859. endif
  1860.  
  1861. cd  $rootdir
  1862. if ($doc_install) then
  1863.     echo "Copying SNiFF+ documentation into $rootdir/doc ..."
  1864.     mkdir doc >& /dev/null
  1865.     chmod 755 doc
  1866.     cd doc
  1867.     $gz -d -c < $kitroot/$nl_docfiles[$iname]| cat | $gtar -xopf - > /dev/null
  1868. endif
  1869. cd  $rootdir
  1870. if ($exa_install) then
  1871.     echo "Installing Example sources for the tutorials including ET++ in $rootdir/example ..."
  1872.     if ($exa_install == 2) then
  1873.     rm -fr $rootdir/example >& /dev/null
  1874.     endif
  1875.     $gz -d -c < $kitroot/$nl_examples[$iname] | cat | $gtar -xopf - > /dev/null
  1876.     chmod 777 $rootdir/example
  1877. endif
  1878. cd $rootdir
  1879. if ($visaj_install) then
  1880.     echo "Installing VisaJ GUI Builder in $rootdir/$visajdir ..."
  1881.     if ($visaj_install == 2) then
  1882.     rm -fr $rootdir/$visajdir >& /dev/null
  1883.     endif
  1884.     $gz -d -c < $kitroot/$nl_visaj[$iname] | cat | $gtar -xopf - > /dev/null
  1885.     chmod 755 $rootdir/$visajdir
  1886. endif
  1887.  
  1888. set vim_installed = 0
  1889. if ( -d $rootdir/config/vim ) then
  1890.     set vim_installed = 1
  1891. endif
  1892. foreach iarch ($iarchs)
  1893.     set bin_install = $l_bin_install[$iarch]
  1894.     set vim_bin_install = $l_vim_bin_install[$iarch]
  1895.     set kitdir = $kitdirs[$iarch]
  1896.     set kit_arch = $kit_archs[$iarch]
  1897.     if ($bin_install) then
  1898.     cd  $rootdir
  1899.     echo "Installing binaries of SNiFF+ $SNiFFversion for $kit_arch ..."
  1900.     if ($bin_install == 2) then
  1901.         $gz -d -c < $kitroot/$kitdir/$nl_sniffbin[$iname] | cat | $gtar -tf -  | awk '{print $1}' | xargs -i $tmp_script {}
  1902.     endif
  1903.     $gz -d -c < $kitroot/$kitdir/$nl_sniffbin[$iname] | cat | $gtar -xopf - > /dev/null
  1904. #    if ( -f $kitroot/$kitdir/$nl_tar[$iname] ) then
  1905. #        cp  $kitroot/$kitdir/$nl_tar[$iname] bin/tar
  1906. #        chmod 755 bin/tar
  1907. #    endif 
  1908.     endif
  1909.     if ($vim_bin_install) then
  1910.     cd  $rootdir
  1911.     echo "Installing Vim 5.0 binaries for $kit_arch ..."
  1912.     if ($vim_bin_install == 2 || $vim_installed) then
  1913.         $gz -d -c < $kitroot/$kitdir/$nl_vimbin[$iname] | cat | $gtar -tf -  | awk '{print $1}' | xargs -i $tmp_script {}
  1914.     endif
  1915.     $gz -d -c < $kitroot/$kitdir/$nl_vimbin[$iname] | cat | $gtar -xopf - > /dev/null
  1916.     set vim_installed = 1
  1917.     endif
  1918.  
  1919. end  # foreach iarch
  1920.  
  1921. if ( -f $tmp_script ) then
  1922.     /bin/rm -f  $tmp_script 
  1923. endif
  1924.  
  1925. #
  1926. #    change permissions to read-only    
  1927. #    
  1928. if ($common_install) then
  1929.     chmod 755 $rootdir/bin
  1930.     chmod 444 $rootdir/Version 
  1931.     chmod 555 $rootdir/bin/sniff_wrapper 
  1932. endif
  1933.  
  1934. if ("$user" != "root") then
  1935.     goto endinstall
  1936. endif
  1937.  
  1938. while ( ( -e $tmperr ) || { sh -c "test -h $tmperr" } )
  1939.     set tmperr = $tmperr"_"
  1940. end
  1941.  
  1942. echo ""
  1943. echo "Please enter the login name or user ID of the user who should be the owner"
  1944. echo "of the current SNiFF+ installation."
  1945. get_owner:
  1946. echo ""
  1947. echo "Login name/user ID? " | awk ' { printf "%s", $0 }'
  1948. set us = `/bin/sh -c 'read a; echo $a'`
  1949. if ( "$us" != "" ) then
  1950.         echo ""
  1951.         echo "Changing owner to '$us' ..."
  1952.         # check before recursive call
  1953.         chown $us $rootdir/. >& $tmperr
  1954.         if ($status != 0) then    # error: no permission, wrong uid, etc.
  1955.             cat $tmperr
  1956.             echo "Cannot change owner to '$us'"
  1957.             goto get_owner
  1958.         endif
  1959.         # for those systems that have chown -h
  1960.         find $rootdir -type l -exec chown -h $us {} \; >& /dev/null
  1961.         find $rootdir ! -type l -exec chown $us {} \; > /dev/null
  1962.         if ($status == 0) then
  1963.             echo "Owner changed."
  1964.         else
  1965.             echo "Cannot change owner to '$us'"
  1966.             goto get_owner
  1967.         endif
  1968. else
  1969.         echo "Owner not changed."
  1970. endif 
  1971.  
  1972. echo ""
  1973. echo "Please enter the group name or group ID which should be applied to"
  1974. echo "the current SNiFF+ installation."
  1975. get_group:
  1976. echo ""
  1977. echo "Group name/ID? " | awk ' { printf "%s", $0 }'
  1978. set grp = `/bin/sh -c 'read a; echo $a'`
  1979. if ( "$grp" != "" ) then
  1980.     echo ""
  1981.     echo "Changing group to '$grp' ..."
  1982.     chgrp $grp $rootdir/. >& $tmperr
  1983.     if ($status != 0) then    # error: no permission, wrong gid, etc.
  1984.         cat $tmperr
  1985.         echo "Cannot change group to '$grp'"
  1986.         goto get_group
  1987.     endif
  1988.     find $rootdir -type l -exec chgrp -h $grp {} \; >& /dev/null
  1989.     find $rootdir ! -type l -exec chgrp $grp {} \; > /dev/null
  1990.     if ($status == 0) then
  1991.         echo "Group changed."
  1992.     else
  1993.         echo "Cannot change group to '$grp'"
  1994.         goto get_group
  1995.     endif
  1996. else
  1997.     echo "Group not changed."
  1998. endif 
  1999.  
  2000. /bin/rm -f $tmperr >& /dev/null
  2001.  
  2002. endinstall:
  2003. if ( "$gname" == "4" ) then
  2004.     rm /tmp/$nl_zcat[$gname] >& /dev/null
  2005.     rm /tmp/$nl_tar[$gname] >& /dev/null
  2006. endif
  2007.  
  2008. if ($selection == 2) goto end
  2009.  
  2010. set license_entered = 0
  2011. if ($bin_install) then
  2012.     # ask for license string
  2013.     echo ""
  2014.     echo "It is possible to enter the license now, line by line,"
  2015.     echo "or later, by editing the file $rootdir/license.dat."
  2016.     echo ""
  2017.     echo "Note: If you don't have an evaluation or permanent license"
  2018.     echo "      key you are using 'Personal SNiFF+'."
  2019.     echo "      Personal SNiFF+ is licensed for non-commercial use and evaluations"
  2020.     echo "      only. Commercial use is prohibited. While using Personal SNiFF+,"
  2021.     echo "      project size is limited to 200 files. In addition, remote development"
  2022.     echo "      capabilities and code generation from the GUI builder are disabled."
  2023.     echo "      Please contact TakeFive Software at <http://www.takefive.com/>"
  2024.     echo "      if you would like to receive a free unlimited-use evaluation key"
  2025.     echo "      or to purchase a permanent license key for commercial use."
  2026.     echo "      For details, please see the end-user license agreement."
  2027.     echo ""
  2028.     echo "Would you like to enter your license string(s) now [y]? " | awk '{printf "%s", $0}'
  2029. ask_license_again:
  2030.     set c = `/bin/sh -c 'read a; echo $a'`
  2031.     if ("$c" == "") set c = "y"
  2032.     switch ("$c")
  2033.     case [nN*]:
  2034.     goto ask_for_install_check
  2035.     default:
  2036.     if (! $license_entered) then
  2037.         echo ""
  2038.         echo "Example of a product license:"
  2039.         echo "SERVER test1 5542257a 7594"
  2040.         echo "DAEMON takefive <sniff_dir>/bin "
  2041.         echo 'FEATURE SNiFF takefive 3.000 01-jan-00 4 FCBB0CA81DB2B47A821FD ""'
  2042.         echo ""
  2043.         echo "Example of an evaluation license:"
  2044.         echo 'FEATURE SNiFF_EVAL none 3.000 31-Jan-1999 0 CCD3E651C5AD41BD4BF1 "" DEMO'
  2045.     endif
  2046.     endsw
  2047.  
  2048.     set license_entered = 1
  2049. ask_for_license:    
  2050.     echo ""
  2051.     echo "Your license string (you have to enter product licenses line by line): "
  2052.     set license = `/bin/sh -c 'read a; echo $a'`
  2053.     switch ("$license")
  2054.         case SERVER*:
  2055.             set linepat = 'SERVER'
  2056.             breaksw
  2057.         case DAEMON*:
  2058.             set linepat = 'DAEMON'
  2059.             breaksw
  2060.         case *DEMO:
  2061.             set linepat = 'DEMO'
  2062.             breaksw
  2063.         case FEATURE*:
  2064.             set linepat = 'FEATURE'
  2065.             breaksw
  2066.         default:
  2067.             echo ""
  2068.             echo "The license string seems to be incorrect. Please retry."
  2069.             goto ask_license_again
  2070.     endsw
  2071.     echo ""
  2072.     echo "Please confirm your input: "
  2073.     echo ""
  2074.     echo "$license"
  2075.     echo ""
  2076.     echo "Is the string correct [y]? " | awk '{printf "%s", $0}'
  2077.     set c = `/bin/sh -c 'read a; echo $a'`
  2078.     if ("$c" == "") set c = "y"
  2079.     switch("$c")
  2080.         case [nN*]:
  2081.             goto ask_for_license
  2082.         default:
  2083.     endsw
  2084.     # determine line number where to insert string
  2085.     set line = (`sed -n -e "/$linepat/=" "$rootdir/license.dat"`)
  2086.     if ("$line" == "") then
  2087.         set line = 1
  2088.     else
  2089.         set line = $line[$#line]
  2090.     endif
  2091.     @ line2 = $line + 1
  2092.     head -$line2 $rootdir/license.dat >! $rootdir/license.dat.new
  2093.     echo "$license" >> $rootdir/license.dat.new
  2094.     tail +$line $rootdir/license.dat >> $rootdir/license.dat.new
  2095.     /bin/rm -f $rootdir/license.dat
  2096.     mv -f $rootdir/license.dat.new $rootdir/license.dat
  2097.     echo ""
  2098.     echo "The license string has been added to $rootdir/license.dat"
  2099.     echo ""
  2100.     echo "Would you like to enter another license string [y]? " | awk '{printf "%s", $0}'
  2101.     goto ask_license_again
  2102. endif
  2103. # ask for install.check
  2104. ask_for_install_check:
  2105. echo ""    
  2106. echo "Run automatic installation check [y]? " | awk ' { printf "%s", $0 }'
  2107. set c = `/bin/sh -c 'read a; echo $a'`
  2108. if ("$c" == "") set c = "y"
  2109. switch("$c")
  2110. case    [yY]*:
  2111.         $rootdir/bin/install.check $rootdir
  2112.         breaksw
  2113. default:
  2114. endsw
  2115. echo ""
  2116.     
  2117. ask_for_continue_install:
  2118. echo "Continue with installation of other packages [n] ? " | awk ' { printf "%s", $0 }'
  2119. set c = `/bin/sh -c 'read a; echo $a'`
  2120. if ("$c" == "") set c = "n"
  2121. switch("$c")
  2122. case    [nN]*:
  2123.         goto end
  2124. case    [yY]*:
  2125.         goto start_install
  2126. default:
  2127.         goto ask_for_continue_install
  2128. endsw
  2129. end:
  2130. echo ""
  2131. echo "Installation complete."
  2132. if ($bin_install) then 
  2133.     echo ""
  2134.     echo "Please continue installation by setting the necessary environment"
  2135.     echo '(Chapter "Setting the environment variables" of the "Installation Guide").'
  2136.     echo ""
  2137. endif
  2138. exit 0
  2139.  
  2140. quit:
  2141. echo ""
  2142. echo "Installation terminated."
  2143. exit 1
  2144.  
  2145.